package rus.model;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;

@Entity
@Table
public class Product implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = -6088176287444778883L;
	
	private Long id;	
	private String name;
	private String URL;
	private Long price;
	private String currency;
	private ContentImage image;
	private String description;
	private ProductCategory productCategory;
	private Shop shop;
	
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	public Long getId() {
		return id;
	}
	
	@Column(name="name",nullable=false,length=500)
	public String getName() {
		return name;
	}
	
	@Column(name="price")
	public Long getPrice() {
		return price;
	}
	
	
	@OneToOne
	@JoinColumn(nullable=true)
	public ContentImage getImage() {
		return image;
	}
	
	@Column(name="description",nullable=false,length=1000)
	public String getDescription() {
		return description;
	}
	
	@ManyToOne
	@JoinColumn(name="product_category")
	public ProductCategory getProductCategory() {
		return productCategory;
	}
	
	@ManyToOne
	@JoinColumn(name="shop")
	public Shop getShop() {
		return shop;
	}
	
	@Column(nullable=false)
	public String getURL() {
		return URL;
	}	
	
	@Column(length = 4)
	public String getCurrency() {
		return currency;
	}

	
	public void setId(Long id) {
		this.id = id;
	}
	public void setName(String name) {
		this.name = name;
	}
	public void setPrice(Long price) {
		this.price = price;
	}
	public void setImage(ContentImage image) {
		this.image = image;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	public void setProductCategory(ProductCategory productCategory) {
		this.productCategory = productCategory;
	}

	public void setURL(String uRL) {
		URL = uRL;
	}

	public void setCurrency(String currency) {
		this.currency = currency;
	}

	public void setShop(Shop shop) {
		this.shop = shop;
	}	

}
